﻿using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;

namespace AbpToDomain.EntityInfo
{
    //物料
    public class MaterialBase : Entity
    {
        [Key]
        public Guid Id_Materialbase { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime? UpdateTime { get; set; }
        [Comment("客户入库时间")]
        public DateTime? PutInDate { get; set; }
        [Comment("物料名称")]
        public string? MaterialName { get; set; }
        [Comment("唯一码")]
        public string MaterialuniqueCode { get; set; }
        [Comment("物料编号")]
        public string? MaterialCode { get; set; }
        [Comment("物料id")]
        public string? Consumer_MaterialId { get; set; }
        [Comment("1个单位物料数量")]
        public int? Quantity { get; set; }
        [Comment("是否锁定")]
        public bool Islock {  get; set; }
        [Comment("批次号")]
        public string? Batch { get; set; }
        [Comment("入库状态")]
        public string? State { get; set; }
        [Comment("入库类型")]
        public string? Type{ get; set; }
        [Comment("操作者")]
        public string? PeoPle {  get; set; }
        [Comment("重量")]
        public string? Poundage {  get; set; }
        //foreign key     
        public BoxPosition? BoxPosition { get; set; }
        public Guid? Id_BoxPosition { get; set; }
        //public MaterialProperty? MaterialProperty { get; set; }


        public List<MaterialOrder>? MaterialOrders { get; set; } = new List<MaterialOrder>();
        public List<NeetOutMaterial>? NeetOutMaterials { get; set; }=new List<NeetOutMaterial>();
        public override object[] GetKeys()
        {
            return new object[] { Id_Materialbase };
        }
        //function
        public MaterialBase AddMaterialBase( int? Quantity, 
        string MaterialCode,string MaterialName, BoxPosition? 
               boxGrid)
        {
            MaterialBase materialBase = new MaterialBase();
            materialBase.MaterialCode = MaterialCode;
            materialBase.MaterialName = MaterialName;
            materialBase.Quantity = Quantity;  
    
            materialBase.BoxPosition = BoxPosition;       
            materialBase.CreatedDate = DateTime.Now;           
            return materialBase;
        }
        public MaterialBase() 
        {
           
        }
    }
    public class MaterialProperty : Entity
    {
        [Key]
        public Guid MaterialProertyid { get; set; }
        [Comment("属性名称")]
        public string MaterialProertyname { get; set;}
        [Comment("单位")]
        public string? Unit { get; set; }
        [Comment("类型")]
        public string? Type { get; set; }
        [Comment("说明")]
        public string? Description { get; set; }
        [Comment("物料大小")]
        public string? Size { get; set; }
        public string? Info { get; set; }
        public string? Info2 {  get; set; }
        public string? Info3 {  get; set; }
        public string? Info4 {  get; set; }
        public override object[] GetKeys()
        {
            return new object[] { MaterialProertyid };
        }
        //foreignkey
        //public List<MaterialBase> materialBases { get; set; }=new List<MaterialBase>();
        //function
        public MaterialProperty AddMaterialProerty(string MaterialProertyName,string? Unit,string?Type,string?Description,
                                        string?Size,string?Info,string?Info2,string? Info3,string?Info4)
        {
            MaterialProperty materialProperty = new MaterialProperty();
            materialProperty.MaterialProertyname = MaterialProertyName;
            materialProperty.Unit = Unit;
            materialProperty.Type = Type;
            materialProperty.Description = Description;
            materialProperty.Size = Size;
            materialProperty.Info = Info;
            materialProperty.Info2 = Info2;
            materialProperty.Info3 = Info3;
            materialProperty.Info4 = Info4;
            return materialProperty;
        }
    }
}
